package org.cogaen.java2d;

import java.awt.Color;

import org.cogaen.core.Core;
import org.cogaen.resource.ResourceHandle;

public class ColorHandle extends ResourceHandle {

	private Color color;
	private boolean loaded;
	
	public ColorHandle(String resourceName, Color color) {
		super(resourceName);
		this.color = color != null ? color : Color.CYAN;
		this.loaded = false;
	}
	
	public ColorHandle(String resourceName) {
		this(resourceName, null);
	}
	
	@Override
	public boolean isLoaded() {
		return this.loaded;
	}

	@Override
	public void load(Core core) {
		this.loaded = true;
	}

	@Override
	public void unload() {
		this.loaded = false;
	}

	@Override
	public Object getResource() {
		return this.loaded ? this.color : null;
	}

}
